package bancosys.tec.persist.hibernate;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import org.hibernate.annotations.IndexColumn;

import bancosys.tec.persist.bussobj.PersistableBusinessObject;

/**
 * @author MarceloT
 */
@Entity
public class ClasseComArray extends PersistableBusinessObject {

    /**
     *
     */
    private static final long serialVersionUID = 1L;

    private long id;

    private Associacao[] associacoes = new Associacao[0];

    /**
     * @return the id
     */
    @Id
    @GeneratedValue
    public long getId() {
        return this.id;
    }

    /**
     * @param id the id to set
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * @return the associacoes
     */
    @OneToMany
    @Cascade({ CascadeType.SAVE_UPDATE })
    @IndexColumn(name = "indice")
    public Associacao[] getAssociacoes() {
        return this.associacoes;
    }

    /**
     * @param associacoes the associacoes to set
     */
    public void setAssociacoes(Associacao[] associacoes) {
        this.associacoes = associacoes;
    }

}
